import { isObject } from '../../shared/utils';
import { mutableHandler } from './mutableHandler';

export function useReactive(target) {
    return useReactObject(target, mutableHandler);
}

function useReactObject(target, baseHandler) {
    if (!isObject(target)) {
        return target;
    }
    const observer = new Proxy(target, baseHandler);
    return observer;
}